﻿/* ----------------------------------------------------------------------------
 * Copyright (c) Rob Ashton 2009
 *
 * This source code is subject to terms and conditions of the Microsoft Public 
 * License (Ms-PL).
 * 
 * By using this source code in any fashion, you are agreeing to be bound 
 * by the terms of the Microsoft Public License.
 * 
 * To request a copy of the Microsoft Public License, send a request by email
 * to license@mvcex.com
 *
 * This notice must not be removed from this software.
 * ---------------------------------------------------------------------------- */

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using MvcEx.Controllers;
using MvcEx.Configuration;
using MvcEx.Views;

namespace MvcEx
{
    /// <summary>
    /// 
    /// </summary>
    public interface IMvcExApplication
    {
        /// <summary>
        /// Raised when the configuration is reloaded for some reason
        /// </summary>
        event EventHandler ConfigurationChanged;

        /// <summary>
        /// Gets the controller factory used within the application
        /// </summary>
        MvcExControllerFactory ControllerFactory
        {
            get;
        }

        /// <summary>
        /// Gets the view engine used within the application
        /// </summary>
        MvcExViewEngine ViewEngine
        {
            get;
        }        

        /// <summary>
        /// Gets the active configuration from the application
        /// </summary>
        /// <returns></returns>
        MvcExConfiguration GetActiveConfiguration();

        /// <summary>
        /// Gets a module from the application by id
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        MvcExModule GetModuleById(string id);

        /// <summary>
        /// Returns a list of loaded configurations
        /// </summary>
        /// <returns></returns>
        IEnumerable<MvcExConfiguration> GetConfigurations();

        /// <summary>
        /// Forces a reload of the entire configuration
        /// </summary>
        void Reload();

        /// <summary>
        /// Sets the configuration selector being used by this application
        /// </summary>
        /// <param name="mConfigSelector"></param>
        void SetConfigurationSelector(IMvcExApplicationConfigurationSelector configSelector);
    }
}
